package com.off.offgameframework.audio;

import android.media.SoundPool;

import com.off.offgameframework.interfaces.Sound;

/**
 *<p>
 * <b>AndroidSound</b> class is used for playing in-game short sounds(e.g. blows, crashes etc). For playing background
 * music use <b>AndroidMusic</b> class, it will stream music from file
 * </p>
 *  @author Aleksey.Volkov <br/>
 */
public class AndroidSound implements Sound {
	int soundId;
	SoundPool soundPool;

	public AndroidSound(SoundPool soundPool, int soundId) {
		this.soundId = soundId;
		this.soundPool = soundPool;
	}

	public void play(float volume) {
		soundPool.play(soundId, volume, volume, 0, 0, 1);
	}

	public void dispose() {
		soundPool.unload(soundId);
	}

}
